package com.zwkj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zwkj.pojo.vo.WFileWatermarkTVo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

import org.springframework.beans.BeanUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zwkj.domain.WFileWatermarkT;
import com.zwkj.service.IWFileWatermarkTService;
import com.zwkj.mapper.WFileWatermarkTMapper;
import org.springframework.stereotype.Service;

/**
 * @author 小间隙
 * @description 针对表【w_file_watermark_t】的数据库操作Service实现
 * @createDate 2023-12-11 11:32:53
 */
@Service
public class WFileWatermarkTServiceImpl extends ServiceImpl<WFileWatermarkTMapper, WFileWatermarkT>
        implements IWFileWatermarkTService {

    @Autowired
    private IWFileWatermarkTService wFileWatermarkTService;


    @Override
    public void addWFileWatermarkT(WFileWatermarkTVo wFileWatermarkTVo) {
        WFileWatermarkT wFileWatermarkT = new WFileWatermarkT();
        BeanUtils.copyProperties(wFileWatermarkTVo, wFileWatermarkT);

        wFileWatermarkTService.save(wFileWatermarkT);
    }

    @Override
    public IPage<WFileWatermarkTVo> getWFileWatermarkTPageList(IPage<WFileWatermarkTVo> page, WFileWatermarkTVo wFileWatermarkTVo) {
        return this.baseMapper.getWFileWatermarkTPageList(page, wFileWatermarkTVo);
    }


    @Override
    public List<WFileWatermarkTVo> getWFileWatermarkTList(WFileWatermarkTVo wFileWatermarkTVo) {
        return this.baseMapper.getWFileWatermarkTList(wFileWatermarkTVo);

    }

    @Override
    public WFileWatermarkT getWFileWatermarkTById(String id) {
        return wFileWatermarkTService.getById(id);
    }


    @Override
    public void delWFileWatermarkT(String id) {
        wFileWatermarkTService.removeById(id);
    }

    @Override
    public WFileWatermarkTVo fileWatermark(String fileId) {
        List<WFileWatermarkT> list = wFileWatermarkTService.list(new QueryWrapper<WFileWatermarkT>().eq("file_id", fileId));
        if (list.size() > 0) {
            WFileWatermarkTVo vo = new WFileWatermarkTVo();
            BeanUtils.copyProperties(list.get(0),vo);
            return vo;
        }
        return null;
    }


    @Override
    public void updateWFileWatermarkT(WFileWatermarkTVo wFileWatermarkTVo) {
        WFileWatermarkT wFileWatermarkT = new WFileWatermarkT();
        BeanUtils.copyProperties(wFileWatermarkTVo, wFileWatermarkT);
        wFileWatermarkTService.updateById(wFileWatermarkT);
    }
}




